use "BJPS_AB5_Data.dta", clear


*** FIGURE 1

reg RelPrivateMatter01 i.Friday##c.AlwaysMost Prayer01  Age Q1002 Q1003 Employed   i.country##c.IncomeDifficulties if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store A

reg ShouldntInfluence01 i.Friday##c.AlwaysMost Prayer01  Age Q1002 Q1003 Employed   i.country##c.IncomeDifficulties if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store B

reg SameRights01 i.Friday##c.AlwaysMost  Prayer01 Q1002 Q1003 Employed   i.country##c.IncomeDifficulties if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store C

reg PreferSecularParty01 i.Friday##c.AlwaysMost Prayer01  Age Q1002 Q1003 Employed   i.country##c.IncomeDifficulties if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store D

	*** FOR COMBINING WITH AB3
	coefplot A B C D, xline(0) scheme(s1mono) legend(size(small)  position(9) cols(1)) graphregion(color(white)) bgcolor(white) plotlabels("Religious practices private & should be separate from pol/social life" "Religious leaders should not influence government" "Non-Muslims should have the same rights in Muslim countries" "Prefer Non-Religious Party", wrap(35)) levels(95 90)  xtitle(Marginal Effect of Friday Interview) saving(ab5_combined, replace) title(Arab Barometer Wave 5)

**** APPENDICES
	
***** TABLE A6
estimates clear 
reg RelPrivateMatter01 i.Friday##c.AlwaysMost Prayer01  Age Q1002 Q1003 Employed   i.country##c.IncomeDifficulties if Muslim == 1
estimates store coef_A

reg ShouldntInfluence01 i.Friday##c.AlwaysMost Prayer01  Age Q1002 Q1003 Employed   i.country##c.IncomeDifficulties if Muslim == 1
estimates store coef_B

reg SameRights01 i.Friday##c.AlwaysMost  Prayer01 Q1002 Q1003 Employed   i.country##c.IncomeDifficulties if Muslim == 1
estimates store coef_C

reg PreferSecularParty01 i.Friday##c.AlwaysMost Prayer01  Age Q1002 Q1003 Employed   i.country##c.IncomeDifficulties if Muslim == 1
estimates store coef_D

esttab coef* using ab5.tex,  se b(%9.2f) star(* 0.1 ** 0.05 *** 0.01)  replace label tex r2 compress 

**** FIGURE A1

reg RelPrivateMatter01 i.Friday##c.AlwaysMost Prayer01  Age Q1002 Q1003 Employed  i.Q503A  i.country##c.IncomeDifficulties if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store A

reg ShouldntInfluence01 i.Friday##c.AlwaysMost Prayer01  Age Q1002 Q1003 Employed i.Q503A  i.country##c.IncomeDifficulties if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store B

reg SameRights01 i.Friday##c.AlwaysMost   Prayer01 Q1002 Q1003 Employed i.Q503A  i.country##c.IncomeDifficulties if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store C

reg PreferSecularParty01 i.Friday##c.AlwaysMost Prayer01  Age Q1002 Q1003 Employed  i.Q503A i.country##c.IncomeDifficulties if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store D

	coefplot A B C D, xline(0) scheme(s1mono) legend(size(small)  position(9) cols(1)) graphregion(color(white)) bgcolor(white) plotlabels("Religious practices private & should be separate from pol/social life" "Religious leaders should not influence government" "Non-Muslims should have the same rights in Muslim countries" "Prefer Non-Religious Party", wrap(35)) levels(95 90)  xtitle(Marginal Effect of Friday Interview) saving(ab5_combined_parties, replace) title(Arab Barometer Wave 5)

	
	
	*** FIGURE A6
	estimates clear
	foreach var of varlist  RelPrivateMatter01  ShouldntInfluence01 SameRights01 PreferSecularParty01   {
	reg `var' i.Friday##c.AlwaysMost Prayer01  Age Q1002 Q1003 Employed   i.country##c.IncomeDifficulties if Muslim == 1  & Q1002 == 1
	margins, dydx(Friday) over(AlwaysMost) post
	estimates store male_`var'
	}
	
		foreach var of varlist  RelPrivateMatter01  ShouldntInfluence01 SameRights01 PreferSecularParty01 {
	reg `var' i.Friday##c.AlwaysMost Prayer01  Age Q1002 Q1003 Employed   i.country##c.IncomeDifficulties if Muslim == 1  & Q1002 == 2
	margins, dydx(Friday) over(AlwaysMost) post
	estimates store female_`var'
	}


coefplot male*, saving(men_ab5, replace) scheme(s1mono) title("Men") ytitle("") xline(0) xlabel(, grid)  grid(between glpattern(dash) glwidth(*2) glcolor(gray)) legend(position(6) cols(1))  plotlabels("Religious practices private & should be separate from pol/social life" "Religious leaders should not influence government" "Non-Muslims should have the same rights in Muslim countries" "Prefer Non-Religious Party") levels(95 90) 

coefplot female*, saving(women_ab5, replace) scheme(s1mono) title("Women") ytitle("") xline(0) xlabel(, grid)  grid(between glpattern(dash) glwidth(*2) glcolor(gray)) legend(position(6) cols(1))  plotlabels("Religious practices private & should be separate from pol/social life" "Religious leaders should not influence government" "Non-Muslims should have the same rights in Muslim countries" "Prefer Non-Religious Party") levels(95 90) 

grc1leg men_ab5.gph women_ab5.gph, scheme(s1mono)
	
	
	*** SUMMARY STATS
	
	sutex RelPrivateMatter01  ShouldntInfluence01 SameRights01 PreferSecularParty01 AlwaysMost Prayer01 Q1002 Q1003 Employed IncomeDifficulties  Friday if Muslim == 1, digits(2) labels minmax 

	
*** CORRELATION MATRIX
estimates clear
estpost corr RelPrivateMatter01  ShouldntInfluence01 SameRights01 PreferSecularParty01 if Muslim == 1, matrix
esttab . using corr_ab5.tex, not unstack compress noobs nostar label replace
